/**
 * // ============================================================================
 * //
 * // Copyright (C) 2006-2007 Dengues
 * //
 * // Google Group: http://groups.google.com/group/dengues
 * // QQ Group: 24885404
 * //
 * // This library is free software; you can redistribute it and/or
 * // modify it under the terms of the GNU Lesser General Public
 * // License as published by the Free Software Foundation; either
 * // version 2.1 of the License.
 * //
 * // This library is distributed in the hope that it will be useful,
 * // but WITHOUT ANY WARRANTY; without even the implied warranty of
 * // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * // Lesser General Public License for more details.
 * //
 * // You should have received a copy of the GNU General Public License
 * // along with this program; if not, write to the Free Software
 * // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 * //
 * // ============================================================================
 * 
 *
 * $Id$
 */
package org.dengues.model.reports.impl;

import java.util.Collection;

import org.dengues.model.reports.RepColumn;
import org.dengues.model.reports.RepGroup;
import org.dengues.model.reports.RepTable;
import org.dengues.model.reports.ReportsPackage;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Rep Table</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.dengues.model.reports.impl.RepTableImpl#getColumns <em>Columns</em>}</li>
 *   <li>{@link org.dengues.model.reports.impl.RepTableImpl#getGroups <em>Groups</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RepTableImpl extends AbstractReportObjectImpl implements RepTable {
    /**
     * The cached value of the '{@link #getColumns() <em>Columns</em>}' containment reference list.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getColumns()
     * @generated
     * @ordered
     */
    protected EList<RepColumn> columns;

    /**
     * The cached value of the '{@link #getGroups() <em>Groups</em>}' containment reference list.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getGroups()
     * @generated
     * @ordered
     */
    protected EList<RepGroup> groups;

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected RepTableImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    protected EClass eStaticClass() {
        return ReportsPackage.Literals.REP_TABLE;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public EList<RepColumn> getColumns() {
        if (columns == null) {
            columns = new EObjectContainmentEList<RepColumn>(RepColumn.class, this, ReportsPackage.REP_TABLE__COLUMNS);
        }
        return columns;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public EList<RepGroup> getGroups() {
        if (groups == null) {
            groups = new EObjectContainmentEList<RepGroup>(RepGroup.class, this, ReportsPackage.REP_TABLE__GROUPS);
        }
        return groups;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case ReportsPackage.REP_TABLE__COLUMNS:
                return ((InternalEList<?>)getColumns()).basicRemove(otherEnd, msgs);
            case ReportsPackage.REP_TABLE__GROUPS:
                return ((InternalEList<?>)getGroups()).basicRemove(otherEnd, msgs);
        }
        return super.eInverseRemove(otherEnd, featureID, msgs);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case ReportsPackage.REP_TABLE__COLUMNS:
                return getColumns();
            case ReportsPackage.REP_TABLE__GROUPS:
                return getGroups();
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @SuppressWarnings("unchecked")
    @Override
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case ReportsPackage.REP_TABLE__COLUMNS:
                getColumns().clear();
                getColumns().addAll((Collection<? extends RepColumn>)newValue);
                return;
            case ReportsPackage.REP_TABLE__GROUPS:
                getGroups().clear();
                getGroups().addAll((Collection<? extends RepGroup>)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case ReportsPackage.REP_TABLE__COLUMNS:
                getColumns().clear();
                return;
            case ReportsPackage.REP_TABLE__GROUPS:
                getGroups().clear();
                return;
        }
        super.eUnset(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case ReportsPackage.REP_TABLE__COLUMNS:
                return columns != null && !columns.isEmpty();
            case ReportsPackage.REP_TABLE__GROUPS:
                return groups != null && !groups.isEmpty();
        }
        return super.eIsSet(featureID);
    }

} //RepTableImpl
